/*
 * Copyright 2011 Sebastian Maurer
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package erepublik.dto;

import java.util.Calendar;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class Battle extends IDType {

	private BattleCountry attacker;
	
	@XmlElement(name="combatant-count")
	private Integer combatantCount;
	
	private BattleCountry defender;
	
	private Progress progress = new Progress();
	
	private IDNameType region;
	
	@XmlElement(name="is-resistance")
	private Boolean resistance;
	
	private IDNameType war;
	
	@XmlElement(name="winner")
	private Integer winnerCountryId;

	public BattleCountry getAttacker() {
		return attacker;
	}

	public Integer getCombatantCount() {
		return combatantCount;
	}

	public BattleCountry getDefender() {
		return defender;
	}

	public IDNameType getRegion() {
		return region;
	}

	public Boolean getResistance() {
		return resistance;
	}

	public IDNameType getWar() {
		return war;
	}

	public Integer getWinnerCountryId() {
		return winnerCountryId;
	}

	public void setAttacker(BattleCountry attacker) {
		this.attacker = attacker;
	}

	public void setCombatantCount(Integer combatantCount) {
		this.combatantCount = combatantCount;
	}

	public void setDefender(BattleCountry defender) {
		this.defender = defender;
	}

	public void setRegion(IDNameType region) {
		this.region = region;
	}

	public void setResistance(Boolean resistance) {
		this.resistance = resistance;
	}

	public void setWar(IDNameType war) {
		this.war = war;
	}

	public void setWinnerCountryId(Integer winnerCountryId) {
		this.winnerCountryId = winnerCountryId;
	}

	public Calendar getFinishedAt() {
		return progress.finishedAt;
	}

	public String getFinishedReason() {
		return progress.finishedReason;
	}

	public Calendar getStartedAt() {
		return progress.startedAt;
	}

	public void setFinishedAt(Calendar finishedAt) {
		this.progress.finishedAt = finishedAt;
	}

	public void setFinishedReason(String finishedReason) {
		this.progress.finishedReason = finishedReason;
	}

	public void setStartedAt(Calendar startedAt) {
		this.progress.startedAt = startedAt;
	}
	
	@XmlType(name="BattleProgress")
	@XmlAccessorType(XmlAccessType.FIELD)
	private static class Progress {
		
		@XmlElement(name="finished-at")
		private Calendar finishedAt;
		
		@XmlElement(name="finished-reason")
		private String finishedReason;
		
		@XmlElement(name="started-at")
		private Calendar startedAt;

	}
	
}
